package com.linshengjian.snowball.core;

import com.linshengjian.snowball.core.exception.SystemErrorException;
import com.linshengjian.snowball.core.page.PageData;
import com.linshengjian.snowball.core.page.PageParam;

import java.io.Serializable;
import java.util.List;

public interface IReadService<M extends BaseModel<ID>, ID extends Serializable> {
    /**
     * 根据ID查询
     * @param id
     * @return
     */
    M get(ID id) throws SystemErrorException;

    /**
     * 获取所有的
     * @return
     */
    List<M> list() throws SystemErrorException;

    /**
     * 根据关键字进行模糊查询
     * @param keywork
     * @return
     */
    List<M> list(String keywork) throws SystemErrorException;

    /**
     * 分页获取所有
     * @param pageReq
     * @return
     */
    PageData<M> list(PageParam pageReq) throws SystemErrorException;

    /**
     * 关键字进行模糊分页进行查询
     * @param keywords
     * @param pageReq
     * @return
     */
    PageData<M> list(String keywords, PageParam pageReq) throws SystemErrorException;
}
